package com.mzy.datepackage.M2021.Nov.Fourteen;


import org.testng.annotations.Test;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author mzy
 * @Date 2021/11/14 17:00
 * @Version 1.0
 */

/**
 * list.add和
 * list.addAll的区别
 */
public class Fourteen {


    @Test
    public void demo(){
        List<Object> list1=new ArrayList<Object>();
        list1.add(1);
        list1.add(2);
        List<Object> list2=new ArrayList<Object>();
        list2.add(0);
        list2.add(3);
        System.out.println(list1.size()+"-------------");


        list1.addAll(1, list2);
        list2.add(list1);
        System.out.println(list2.size()+":list2.size()");
        System.out.println(list1.size()+":list1.size()");
        for (int i = 0; i < list1.size(); i++) {
            System.out.println(list1.get(i));
        }

        System.out.println("++++++++++++++++++++++++++++++++++");
        for (int i = 0; i < list2.size(); i++) {
            System.out.println(list2.get(i));
        }

    }
}
